home *** CD-ROM | disk | FTP | other *** search
- /********************************
- File: About.c
- ********************************/
- /**********************
- Include files
- ***********************/
- #include "String.h"
-
- /**********************
- Constants
- ***********************/
- #define TRUE 1
- #define FALSE 0
- #define NIL 0
- #define I_OK 1
- #define I_Print 2
- #define I_User 7
- #define AboutID 2
- #define TestID 1
-
- /**********************
- Globals
- ***********************/
- static char ExitDialog;
- static DialogPtr GetSelection;
- Rect tempRect;
- short DType;
- Handle DItem;
- Str255 sTemp;
- short itemHit;
- DialogPeek TheDialogPtr;
-
- /**********************
- Refresh_Dialog(GetSelection) bolds OK button
- ***********************/
- static void Refresh_Dialog(GetSelection)
- DialogPtr GetSelection;
- { /* Refresh_Dialog() */
- GetDItem(GetSelection,I_OK, &DType, &DItem, &tempRect);
-
- PenSize(3, 3);
- InsetRect(&tempRect, -4, -4);
-
- FrameRoundRect(&tempRect, 16, 16);
- PenSize(1, 1);
- } /* Refresh_Dialog() */
-
- /**********************
- UpDate_AboutDialog() for printing
- ***********************/
- UpDate_AboutDialog(theWindow)
- WindowPtr theWindow;
- { /* UpDate_AboutDialog() */
- if (theWindow == (WindowPtr) GetSelection) { /* check if "About" dialog */
- PrintDialog((DialogPeek) GetSelection, "\p", "\p", "\p", "\p"); /* print it */
- Refresh_Dialog(GetSelection); /* call any user-drawn stuff */
- }
- } /* UpDate_AboutDialog() */
-
- /**********************
- D_About() handles "About" dialog
- ***********************/
- void D_About()
- { /* D_About() */
- /* Get Dialog */
- GetSelection = GetNewDialog(AboutID, NIL, (WindowPtr)-1);
- ShowWindow(GetSelection);
- SelectWindow(GetSelection);
- SetPort(GetSelection);
-
- /* set it up */
- Refresh_Dialog(GetSelection);
- ExitDialog = FALSE;
-
- do { /* Handle dialog until done */
- ModalDialog(NIL, &itemHit);
- GetDItem(GetSelection, itemHit, &DType, &DItem, &tempRect);
-
- if (itemHit == I_OK)
- ExitDialog =TRUE; /* flag for exit */
-
- if (itemHit == I_Print)
- PrintWindow((WindowPtr) GetSelection); /* print dialog */
-
- Refresh_Dialog(GetSelection);
- } while (ExitDialog == FALSE);
- DisposDialog(GetSelection);
- } /* D_About() */
-
- /**********************
- myUserItem() proc for user item
- ***********************/
- pascal void myUserItem(w, i)
- WindowPtr w;
- int i;
- { /* myUserItem() */
- int t;
- Handle h;
- Rect r;
-
- GetDItem(GetSelection, I_User, &t, &h, &r);
- FrameRect(&r); /* Draw something */
- } /* myUserItem() */
-
- /**********************
- UpDate_TestDialog() for printing
- ***********************/
- UpDate_TestDialog(theWindow)
- WindowPtr theWindow;
- { /* UpDate_TestDialog() */
- if (theWindow == (WindowPtr) GetSelection) { /* check if "Test" dialog */
- PrintDialog((DialogPeek) GetSelection, "\p", "\p", "\p", "\p"); /* print it */
- Refresh_Dialog(GetSelection); /* call any user-drawn stuff */
- }
- } /* UpDate_TestDialog() */
-
- /**********************
- Refresh_Dialog(GetSelection) bolds OK button
- ***********************/
- void D_TestDialog()
- { /* D_TestDialog() */
- /* Get Dialog */
- GetSelection = GetNewDialog(TestID, NIL, (WindowPtr)-1);
- ShowWindow(GetSelection);
- SelectWindow(GetSelection);
- SetPort(GetSelection);
-
- /* set it up */
- GetDItem(GetSelection, I_User, &DType, &DItem, &tempRect); /* set up user-item */
- SetDItem(GetSelection, I_User, DType, myUserItem, &tempRect);
-
- Refresh_Dialog(GetSelection);
- myUserItem((WindowPtr) GetSelection, I_User);
- ExitDialog = FALSE;
-
- do { /* Handle dialog until done */
- ModalDialog(NIL, &itemHit);
- GetDItem(GetSelection, itemHit, &DType, &DItem, &tempRect);
-
- if (itemHit == I_OK)
- ExitDialog =TRUE; /* flag for exit */
-
- if (itemHit == I_Print)
- PrintWindow((WindowPtr) GetSelection); /* print it */
-
- Refresh_Dialog(GetSelection);
-
- } while (ExitDialog == FALSE);
- DisposDialog(GetSelection);
- } /* D_TestDialog() */
-
-